package com.qhhc.controller;


import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class OllamaController {
    @Autowired
    private OllamaChatModel ollamaChatModel;
    @RequestMapping(value = "/ai/ollama")
    public String ollama(@RequestParam(value = "message")String msg){
        System.out.println("read to call");
        String called=ollamaChatModel.call(msg);
//        System.out.println(called);
        String s = called.split("</think>")[1];
        System.out.println(s);
        return s;
    }

}

